<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<jsp:include page="/admin/jsp/common/HtmlHead.jsp"/>
<title>Insert title here</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
function onSubmit(){
	var myFrame = document.getElementById('myFrame');
	if (myFrame.attachEvent){
		myFrame.attachEvent("onload", function(){
	        var idoc = myFrame.contentDocument || myFrame.contentWindow.document;
	        html=idoc.body.innerHTML;
	        resp(eval('('+html+')'));
	    });
	} else {
		myFrame.onload = function(){
	        var idoc =  myFrame.contentDocument || myFrame.contentWindow.document;
	        html=idoc.body.innerHTML;
	        resp(eval('('+html+')'));
	    };
	}
	var loading = document.getElementById('loading');
	loading.style.height = document.body.clientHeight+"px";
	loading.style.display = "block";
	document.forms[0].submit();
}
function resp(json){
	if(json){
		if(json.code=='true'){
			alert('添加成功');
			parent.hideDialog();
		}else{
			alert("添加失败,"+json.msg);
		}
	}else{
		alert('返回值错误')
	}
	hideLoading();
}
function hideLoading(){
	document.getElementById('loading').style.display = "none";
}
</script>
</head>
<body>
	<div id="loading" style="width:100%;position: absolute;left:0px;top:0px;z-index:1;display:none;background-color: #cccccc;opacity: 0.7;filter: alpha(opacity=70); ">Loading...</div>
	<s:form action="batchAddDo" method="post" target="myFrame">
		<s:hidden name="lesson.courseId"/>
		<table width="100%">
			<tr>
				<th>课时名称</th>
				<td>
					<s:textfield name="lesson.name"/>课时数使用%s代替
				</td>
			</tr>
			<tr>
				<th>课时数</th>
				<td>
					从<input type="text" name="startNum"/>到<input type="text" name="endNum"/>
				</td>
			</tr>
			<tr>
				<th>所属课程</th>
				<td>
					<s:textfield name="lesson.courseName" value="%{getCourseName(lesson.courseId)}" disabled="true"/>
				</td>
			</tr>
			<tr>
				<th>授课时长</th>
				<td>
					<s:textfield name="lesson.duration"/>(分)
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<input type="button" onclick="onSubmit()" value="提交"/>
				</td>
			</tr>
		</table>
	</s:form>
	<iframe width="0px" height="0px" style="display:none" name="myFrame" id="myFrame"></iframe>
</body>
<jsp:include page="/admin/jsp/common/errorMessage.jsp"/>
</html>